package com.action;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dto.UserInfo;
import com.service.UserService;
@RestController
public class UserAction {
	@Autowired
	private UserService service;
	@RequestMapping("Ajaxlogin.do")
	public Map<String, Object> Ajaxlogin(UserInfo user,HttpSession sess){
		Map<String, Object> json=new HashMap<String,Object>();
		user=service.login(user);
		if(user!=null) {
			sess.setAttribute("userInfo", user);
			json.put("result", true);	
		}else {
			json.put("result", false);
		}
		return json;
	}	
}
